“Balanced parentheses” 指“括号配对/括号平衡”:在一段表达式或文本中,每一个左括号 ( 都能在正确的顺序与层级上对应到一个右括号 **)**,并且不会出现多余或缺失的括号。常见于数学表达式、编程语法、数据结构与解析(parsing)问题中。
/ˈbælənst pəˈrɛnθəsiːz/
Check your code for balanced parentheses before you run it.
运行前先检查你的代码里括号是否配对。
The parser validates the input by ensuring all nested expressions have balanced parentheses and matching scope.
解析器通过确保所有嵌套表达式的括号平衡并且作用域匹配来验证输入。
“Balanced” 来自 “balance(平衡)”,表示“数量与结构上对称、相互对应”;“parentheses” 来自希腊语词根(与“放在旁边/插入说明”相关),在现代英语中指圆括号 **( )**。组合成短语后,就用来描述括号在结构上“成对出现、嵌套正确”的状态。